package com.SocketDemo.UDPSocketDemo;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.SocketException;

/**
 * @Author milian
 * @Date 2021/7/31 0031 17:26
 */
public class serviceDemo {
    public static void main(String[] args) throws IOException {
        DatagramSocket ds = new DatagramSocket(10086);
        byte[] bytes = new byte[1024];
        DatagramPacket dp = new DatagramPacket(bytes, bytes.length);
        ds.receive(dp);
        System.out.println("数据是："+new String(dp.getData(),0,dp.getLength()));
        ds.close();


    }
}
